/**
 * 便民服务api
 * @author: chenyq
 * @date: 2021-01-27
 */
import request from '@/utils/request';

// 分页查询列表操作
export function page(query) {
  return request({
    url: process.env.VUE_APP_KSTB_ROUTE_PATH + '/infoManage/convenienceService/pageList',
    method: 'get',
    params: query
  });
}


// 获取便民服务树信息
export function queryConServiceTree(parentOid) {
  if(parentOid == undefined){
    parentOid = '';
  }
  return request({
    url: process.env.VUE_APP_KSTB_ROUTE_PATH + '/infoManage/convenienceService/queryConServiceTree?parentOid='+parentOid,
    method: 'get'
  });
}

// 初始化便民服务信息
export function init(id,parentOid) {
  if(id == undefined){
    id ='';
  }
  if(parentOid == undefined){
    parentOid ='';
  }
  return request({
    url: process.env.VUE_APP_KSTB_ROUTE_PATH + '/infoManage/convenienceService/getConvenienceServiceById?id='+id+'&parentOid='+parentOid,
    method: 'get'
  })
}

//删除便民服务信息
export function delConService(id) {
  return request({
    url: process.env.VUE_APP_KSTB_ROUTE_PATH + '/infoManage/convenienceService/deleteConvenienceServiceById?id='+id,
    method: 'post'
  })
}


// 启禁用便民服务信息
export function ableConService(id) {
  return request({
    url: process.env.VUE_APP_KSTB_ROUTE_PATH + '/infoManage/convenienceService/ableConvenienceServiceById?id='+id,
    method: 'post'
  })
}


/**
 *
 * @param {*} data
 * 保存便民服务数据
 */
export function saveOrUpdate(data) {
  return request({
    url:
      process.env.VUE_APP_KSTB_ROUTE_PATH + "/infoManage/convenienceService/saveOrUpdate",
    method: "post",
    headers: {
      "Content-Type": "application/json;charset=UTF-8"
    },
    data: data
  });
}


